﻿using System.Collections.Generic;
using System.Data;
using System;
using SXT.Party.WomenAndChildrens.Model;

namespace ZHDJ.MobileInterface
{
    public partial class InsertWCNewViewNumbers : AbstractBasePage
    {
        protected override OutParam BusinessProcess<InParam, OutParam>(InParam inParam)
        {
            // 业务逻辑返回的响应对象  
            WCNewViewNumbersOutParam result = new WCNewViewNumbersOutParam();
            WCNewViewNumbersInParam param = new WCNewViewNumbersInParam();
            string logMsg = "";
            bool isFlag = true;

            try
            {
                param = inParam as WCNewViewNumbersInParam;


                if (string.IsNullOrEmpty(param.ExpoID))
                {
                    result.code = "0";
                    result.desc = "论点ID不能为空";

                    isFlag = false;
                }
                

                if (isFlag)
                {
                    result.BrowserCount = PartyWCExpertExpoReleaseInfo.AddBrowserCount(param.ExpoID,"true");                    
                }

                logMsg = result.desc;
            }
            catch (Exception ex)
            {
                result.code = "0";
                result.desc = "操作不成功！";
                logMsg = ex.Message + ":" + ex.StackTrace;
            }

            CommonUtils.InsertMobileInterfaceLog(SystemCode + "-InsertWCNewViewNumbers", SerializeHelper.JsonSerializer<WCNewViewNumbersInParam>(param), logMsg);
            return result as OutParam;
        }

        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (string.Compare(Request.QueryString["Safe"], "False", true) == 0)
                ProcessRequest<WCNewViewNumbersInParam, WCNewViewNumbersOutParam>();
            else
                SafeProcessRequest<WCNewViewNumbersInParam, WCNewViewNumbersOutParam>();
        }
    }

    #region 请求参数
    public class WCNewViewNumbersInParam
    {
        /// <summary>
        ///	用户ID （预留拓展）
        /// </summary>
        public string user_id
        { get; set; }

        /// <summary>
        ///	论点ID 必须
        /// </summary>
        public string ExpoID
        { get; set; }
    }
    #endregion

    #region 结果参数
    public class WCNewViewNumbersOutParam
    {
        public WCNewViewNumbersOutParam()
        {
            code = "1";
            desc = "操作成功";
        }

        /// <summary>
        /// 返回结果 具体见接口返回对照码 1	成功 0	失败 2	请求非法 加密结果和传入的MD5字符串进行比较，如果相同则执行接口操作，否则返回1001错误响应码
        /// </summary>
        public string code
        { get; set; }

        /// <summary>
        /// 结果描述 成功和失败都需要
        /// </summary>
        public string desc
        { get; set; }

        /// <summary>
        /// 阅读数
        /// </summary>
        public string BrowserCount
        { get; set; }
    }
    #endregion 
}